﻿using System;
using System.Data;
using System.Collections;
using CE.Database;

/// <summary>
/// Summary description for TAUserOptionDB
/// </summary>
/// 
namespace CE.TravelInsurance
{
    public class TAUserOptionDB
    {
        public TAUserOptionDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(TAUserOption tauseroption)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "[sprocTAUserOptionInsertUpdateSingleItem]";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@TAUserOptionId", tauseroption.TAUserOptionId);
            _sPara.Add("@TAId", tauseroption.TAId);
            _sPara.Add("@IsBuyNow", tauseroption.IsBuyNow);
            _sPara.Add("@IsCallMe", tauseroption.IsCallMe);
            _sPara.Add("@IsEmailMe", tauseroption.IsEmailMe);
            _sPara.Add("@IsEmailThis", tauseroption.IsEmailThis);
            _sPara.Add("@RecipientEmailAddress", tauseroption.RecipientEmailAddress);
            _sPara.Add("@RecipientName", tauseroption.RecipientName);
            _sPara.Add("@ViewedDetailId", tauseroption.ViewedDetailId);
            _sPara.Add("@RefCEUserId", tauseroption.RefCEUserId);
            _sPara.Add("@Ninfo1", tauseroption.Ninfo1);

            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataTable GetTAUserOption(Int64 TAId, Int64 UserId)
        {
            MyDatabase _db = new MyDatabase();
            DataTable _dtResult = new DataTable("Result");
            string _spName = "sprocTAUserOptionSelectItem";

            SortedList _spara = new SortedList();
            _spara.Add("@TAID", TAId);
            _spara.Add("@RefCEUserId", UserId);

            _dtResult = _db.GetDataTableBySP(_spName, _spara);
            return _dtResult;
        }
    }
}